#include "gf_server.h"
#include "Log.h"
#include "GlobalFeature_API.h"

int gf_extract_server::start(){
	string name = "gf_extact";
	set_name(name);
/*	
	string ip = "199.155.122.11";
	string port = "44501";
	set_ip(ip);
	set_port(port);

	ip = "199.155.122.11";
	port = "44504";
	address addr(ip,port);
	add_match_server(addr);
*/
	int ret = 0;
	ret = GLOBALFEATURE_3_2_0::Init("/home/brght/data/gf_index/");
	if(ret != 0){
		LOG_ERROR_VA("Global init failed");
		return -1;
	}
	LOG_INFO_VA("GLOBALFEATURE_3_2_0::version: ");
	GLOBALFEATURE_3_2_0::version();

	LOG_INFO_VA("[%s] server start", get_name().c_str());
	server::start();
	return 0;
}

int gf_merge_server::start(){
	string name = "gf_merge";
	set_name(name);
/*	
	string ip = "199.155.122.11";
	string port = "44504";
	set_ip(ip);
	set_port(port);
*/

	LOG_INFO_VA("[%s] server start", get_name().c_str());
	server::start();

	return 0;
}

int gf_match_server::start(){
	string name = "gf_match";
	set_name(name);
/*	
	string ip = "199.155.122.11";
	string port = "44504";
	set_ip(ip);
	set_port(port);
*/
	database_bdb *db = new database_bdb;
	set_database(db);

	std::string data_path = "/home/murphy/coderoot/projects/v-search/trunk/data/db/";
	LOG_INFO_VA("[%s] data_path: %s",get_name().c_str(),data_path.c_str());
	get_database()->set_data_root_path(data_path);
	
	LOG_INFO_VA("[%s] server start", get_name().c_str());
	server::start();

	return 0;
}




